home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1995 October / EnigmA AMIGA RUN 01 (1995)(G.R. Edizioni)(IT)[!][issue 1995-10][Aminet 7].iso / Aminet / util / dtype / cdt_39_10.lha / cdt / source / RCS / cdt.tab.c,v < prev    next >
Text File  |  1995-06-04  |  57KB  |  2,169 lines

  1. head    39.13;
  2. access;
  3. symbols
  4.     V39_10:39.12
  5.     c3910:39.13
  6.     V39_9:39.10;
  7. locks; strict;
  8. comment    @** @;
  9.  
  10.  
  11. 39.13
  12. date    95.06.04.18.53.53;    author StRuppert;    state Exp;
  13. branches;
  14. next    39.12;
  15.  
  16. 39.12
  17. date    95.06.04.17.04.11;    author StRuppert;    state Exp;
  18. branches;
  19. next    39.11;
  20.  
  21. 39.11
  22. date    95.06.04.16.55.55;    author StRuppert;    state Exp;
  23. branches;
  24. next    39.10;
  25.  
  26. 39.10
  27. date    95.05.10.14.58.53;    author StRuppert;    state Exp;
  28. branches;
  29. next    ;
  30.  
  31.  
  32. desc
  33. @initial
  34. @
  35.  
  36.  
  37. 39.13
  38. log
  39. @*** empty log    message    ***
  40. @
  41. text
  42. @
  43. /*  A Bison parser, made from cdt.y with Bison version GNU Bison version 1.22
  44.   */
  45.  
  46. #define YYBISON 1  /* Identify Bison output.  */
  47.  
  48. #define yyparse cdtparse_parse
  49. #define yylex cdtparse_lex
  50. #define yyerror cdtparse_error
  51. #define yylval cdtparse_lval
  52. #define yychar cdtparse_char
  53. #define yydebug cdtparse_debug
  54. #define yynerrs cdtparse_nerrs
  55. #define    T_INCLUDE    258
  56. #define    T_DEFINE    259
  57. #define    T_UNDEF    260
  58. #define    T_PRAGMA    261
  59. #define    T_LINE    262
  60. #define    T_ERROR    263
  61. #define    T_IF    264
  62. #define    T_IFDEF    265
  63. #define    T_IFNDEF    266
  64. #define    T_ELIF    267
  65. #define    T_ENDIF    268
  66. #define    T_AUTO    269
  67. #define    T_EXTERN    270
  68. #define    T_REGISTER    271
  69. #define    T_STATIC    272
  70. #define    T_CHAR    273
  71. #define    T_SHORT    274
  72. #define    T_INT    275
  73. #define    T_LONG    276
  74. #define    T_SIGNED    277
  75. #define    T_UNSIGNED    278
  76. #define    T_FLOAT    279
  77. #define    T_DOUBLE    280
  78. #define    T_VOID    281
  79. #define    T_USERTYPE    282
  80. #define    T_SWITCH    283
  81. #define    T_CASE    284
  82. #define    T_BREAK    285
  83. #define    T_DEFAULT    286
  84. #define    T_ELSE    287
  85. #define    T_FOR    288
  86. #define    T_DO    289
  87. #define    T_WHILE    290
  88. #define    T_CONTINUE    291
  89. #define    T_CONST    292
  90. #define    T_VOLATILE    293
  91. #define    T_GOTO    294
  92. #define    T_RETURN    295
  93. #define    T_STRUCT    296
  94. #define    T_UNION    297
  95. #define    T_ENUM    298
  96. #define    T_TYPEDEF    299
  97. #define    T_SIZEOF    300
  98. #define    T_CLASS    301
  99. #define    T_PUBLIC    302
  100. #define    T_PRIVATE    303
  101. #define    T_PROTECTED    304
  102. #define    T_VIRTUAL    305
  103. #define    T_FRIEND    306
  104. #define    T_NEW    307
  105. #define    T_DELETE    308
  106. #define    T_OPERATOR    309
  107. #define    T_TRY    310
  108. #define    T_CATCH    311
  109. #define    T_THROW    312
  110. #define    T_INLINE    313
  111. #define    T_ID    314
  112. #define    T_CHR    315
  113. #define    T_NUMBER    316
  114.  
  115. #line 1 "cdt.y"
  116.  
  117. /*
  118. ** $PROJECT: c.datatype
  119. **
  120. ** $VER: cdt.y 39.12 (04.06.95)
  121. **
  122. ** by
  123. **
  124. ** Stefan Ruppert , Windthorststraße 5 , 65439 Flörsheim , GERMANY
  125. **
  126. ** (C) Copyright 1995
  127. ** All Rights Reserved !
  128. **
  129. ** $HISTORY:
  130. **
  131. ** 04.06.95 : 039.012 : fixed c++ comment bug, which was damaged by the V39.11 changes
  132. ** 04.06.95 : 039.011 : handles tabs and spaces correctly, also for printing
  133. ** 10.05.95 : 039.010 : added userdefined types
  134. ** 28.04.95 : 039.009 : fixed tab calculation after a // comment
  135. ** 26.04.95 : 039.008 : fixed bug,a \ at the end of the line within a string wasn't handled correctly
  136. ** 22.04.95 : 039.007 : two bugs fixed (// comments and \ after a string)
  137. ** 14.04.95 : 039.006 : added nested switch
  138. ** 07.04.95 : 039.005 : else keyword wasn't correct sorted
  139. ** 24.03.95 : 039.004 : missing else keyword added
  140. ** 23.03.95 : 039.003 : now full tabs handling
  141. ** 12.03.95 : 039.002 : added C++ keywords
  142. ** 07.03.95 : 039.001 : initial
  143. */
  144.  
  145. #include "classbase.h"
  146.  
  147. /*FS*/ void add_line(struct ClassBase *cb,struct CParse *cparse,ULONG index,UWORD flags)
  148. {
  149.     struct Style *style = &cparse->Data->cd_CStyle[index];
  150.     struct Line *line;
  151.  
  152.     /* ignore segments , which are marked as text and no tabs are found ! */
  153.     if(!(style->Style == ~0 && index != C_STANDARD && cparse->XOffsetAdd == 0) || (flags & LNF_LF))
  154.     {
  155.         if((line = AllocPooled(cparse->Data->cd_Pool,sizeof(struct Line))))
  156.         {
  157.             struct Line *tabline = NULL;
  158.             STRPTR ptr = cparse->SegPtr;
  159.  
  160.             if((style->Style & FSF_UNDERLINED) || cparse->XOffsetAdd > 0)
  161.             {
  162.                 ULONG x = cparse->XOffsetAdd;
  163.  
  164.                 while(*ptr == ' ' || *ptr == '\t')
  165.                 {
  166.                     if(*ptr++ == ' ')
  167.                         x++;
  168.                 }
  169.  
  170.                 if((tabline = AllocPooled(cparse->Data->cd_Pool,sizeof(struct Line))))
  171.                 {
  172.                     tabline->ln_Text    = cparse->Data->cd_TabBuffer;
  173.                     tabline->ln_TextLen = x;
  174.                     tabline->ln_XOffset = cparse->XOffset;
  175.                     tabline->ln_YOffset = cparse->YOffset;
  176.  
  177.                     x *= cparse->TabWidth;
  178.  
  179.                     tabline->ln_Width   = x;
  180.                     tabline->ln_Height  = cparse->RPort->TxHeight;
  181.                     tabline->ln_Flags   = 0;
  182.                     tabline->ln_FgPen   = style->FgPen;
  183.                     tabline->ln_BgPen   = style->BgPen;
  184.                     tabline->ln_Style   = FS_NORMAL;
  185.  
  186.                     cparse->XOffset += x;
  187.  
  188.                     AddTail(cparse->LineList,(struct Node *) tabline);
  189.                 }
  190.             }
  191.  
  192.             line->ln_Text    = ptr;
  193.  
  194.             if(ptr < cparse->ActPtr)
  195.                 line->ln_TextLen = cparse->ActPtr - ptr;
  196.             else
  197.             {
  198.                 line->ln_TextLen = 0;
  199.                 line->ln_Text    = NULL;
  200.             }
  201.  
  202.             if((flags & LNF_LF) && line->ln_TextLen > 0)
  203.                 line->ln_TextLen--;
  204.  
  205.             line->ln_XOffset  = cparse->XOffset;
  206.             line->ln_YOffset  = cparse->YOffset;
  207.             line->ln_Width    = TextLength(cparse->RPort,line->ln_Text,line->ln_TextLen);
  208.             line->ln_Height   = cparse->RPort->TxHeight;
  209.             line->ln_Flags    = flags;
  210.             line->ln_FgPen    = style->FgPen;
  211.             line->ln_BgPen    = style->BgPen;
  212.             if(style->Style != ~0)
  213.                 line->ln_Style = style->Style;
  214.             else
  215.                 line->ln_Style = FS_NORMAL;
  216.  
  217.             if(flags & LNF_LF)
  218.             {
  219.                 if(cparse->XOffset + line->ln_Width > cparse->MaxWidth)
  220.                     cparse->MaxWidth = cparse->XOffset + line->ln_Width;
  221.  
  222.                 cparse->YOffset += line->ln_Height;
  223.                 cparse->XOffset  = 0;
  224.             } else
  225.             {
  226.                 cparse->XOffset += line->ln_Width;
  227.  
  228.                 D({
  229.                     STRPTR ptr = &line->ln_Text[line->ln_TextLen];
  230.                     UBYTE help = *ptr;
  231.  
  232.                     *ptr = '\0';
  233.                     bug("text : %s\n",line->ln_Text);
  234.                     *ptr = help;
  235.                   });
  236.             }
  237.  
  238.             cparse->XOffsetAdd = 0;
  239.             cparse->SegPtr  = cparse->ActPtr;
  240.  
  241.             AddTail(cparse->LineList,(struct Node *) line);
  242.         }
  243.     }
  244. }
  245. /*FE*/
  246.  
  247. /*FS*/ void add_cexpr(struct ClassBase *cb,struct CParse *cparse,ULONG index,BOOL lf)
  248. {
  249.     if(cparse->TxtPtr > cparse->SegPtr && *cparse->SegPtr != '\n')
  250.     {
  251.         STRPTR actptr = cparse->ActPtr;
  252.         ULONG index = (cparse->Mode < C_MAX) ? cparse->Mode : C_STANDARD;
  253.         ULONG x = cparse->XOffsetAdd;
  254.  
  255.         cparse->XOffsetAdd = 0;
  256.         cparse->ActPtr = cparse->TxtPtr;
  257.  
  258.         add_line(cb,cparse,index,0);
  259.  
  260.         cparse->XOffsetAdd = x;
  261.         cparse->SegPtr = cparse->ActPtr;
  262.         cparse->ActPtr = actptr;
  263.     }
  264.  
  265.  
  266.     add_line(cb,cparse,index,lf);
  267.  
  268.     cparse->TxtPtr = cparse->ActPtr;
  269. }
  270. /*FE*/
  271.  
  272.  
  273. #ifndef YYLTYPE
  274. typedef
  275.   struct yyltype
  276.     {
  277.       int timestamp;
  278.       int first_line;
  279.       int first_column;
  280.       int last_line;
  281.       int last_column;
  282.       char *text;
  283.    }
  284.   yyltype;
  285.  
  286. #define YYLTYPE yyltype
  287. #endif
  288.  
  289. #ifndef YYSTYPE
  290. #define YYSTYPE int
  291. #endif
  292. #include <stdio.h>
  293.  
  294. #ifndef __cplusplus
  295. #ifndef __STDC__
  296. #ifndef const
  297. #define const
  298. #endif
  299. #endif
  300. #endif
  301.  
  302.  
  303.  
  304. #define    YYFINAL        147
  305. #define    YYFLAG        -32768
  306. #define    YYNTBASE    67
  307.  
  308. #define YYTRANSLATE(x) ((unsigned)(x) <= 316 ? yytranslate[x] : 101)
  309.  
  310. static const char yytranslate[] = {     0,
  311.      2,     2,     2,     2,     2,     2,     2,     2,     2,    63,
  312.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  313.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  314.      2,     2,     2,    64,    62,     2,     2,     2,    65,     2,
  315.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  316.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  317.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  318.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  319.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  320.      2,    66,     2,     2,     2,     2,     2,     2,     2,     2,
  321.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  322.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  323.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  324.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  325.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  326.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  327.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  328.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  329.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  330.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  331.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  332.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  333.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  334.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  335.      2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
  336.      2,     2,     2,     2,     2,     1,     2,     3,     4,     5,
  337.      6,     7,     8,     9,    10,    11,    12,    13,    14,    15,
  338.     16,    17,    18,    19,    20,    21,    22,    23,    24,    25,
  339.     26,    27,    28,    29,    30,    31,    32,    33,    34,    35,
  340.     36,    37,    38,    39,    40,    41,    42,    43,    44,    45,
  341.     46,    47,    48,    49,    50,    51,    52,    53,    54,    55,
  342.     56,    57,    58,    59,    60,    61
  343. };
  344.  
  345. #if YYDEBUG != 0
  346. static const short yyprhs[] = {     0,
  347.      0,     2,     5,     6,    10,    12,    14,    16,    18,    20,
  348.     23,    24,    28,    30,    32,    34,    36,    38,    40,    42,
  349.     44,    46,    48,    50,    52,    53,    55,    56,    57,    63,
  350.     64,    66,    68,    71,    73,    75,    77,    81,    85,    87,
  351.     88,    93,    95,    97,    99,   101,   103,   105,   107,   109,
  352.    111,   113,   115,   117,   119,   121,   123,   125,   127,   129,
  353.    131,   133,   135,   137,   139,   141,   143,   145,   147,   149,
  354.    151,   153,   155,   156,   160,   161,   165,   167,   169,   171,
  355.    172,   174,   176,   178,   180,   182,   184,   186,   188,   190,
  356.    192,   194,   196,   198,   200,   202,   204,   207,   209,   211,
  357.    213,   217,   218,   219,   226,   227,   229,   231,   233,   235,
  358.    237,   240,   241,   244,   246,   249,   250,   252,   254,   256,
  359.    258,   260,   263,   265,   267,   269,   271,   273,   275
  360. };
  361.  
  362. static const short yyrhs[] = {    68,
  363.      0,    67,    68,     0,     0,    62,    69,    70,     0,    63,
  364.      0,    90,     0,    91,     0,    82,     0,    92,     0,    71,
  365.     63,     0,     0,    73,    72,    74,     0,    75,     0,     3,
  366.      0,     5,     0,     6,     0,     7,     0,     8,     0,     9,
  367.      0,    10,     0,    11,     0,    12,     0,    13,     0,    32,
  368.      0,     0,    92,     0,     0,     0,     4,    76,    59,    77,
  369.     78,     0,     0,    79,     0,    80,     0,    79,    80,     0,
  370.     59,     0,    60,     0,    61,     0,    64,    98,    64,     0,
  371.     65,    96,    65,     0,    62,     0,     0,    66,    63,    81,
  372.     78,     0,    83,     0,    84,     0,    37,     0,    38,     0,
  373.     28,     0,    29,     0,    30,     0,     9,     0,    32,     0,
  374.     33,     0,    34,     0,    35,     0,    36,     0,    40,     0,
  375.     31,     0,    39,     0,    44,     0,    45,     0,    47,     0,
  376.     48,     0,    49,     0,    50,     0,    51,     0,    52,     0,
  377.     53,     0,    54,     0,    55,     0,    56,     0,    57,     0,
  378.     58,     0,    85,     0,     0,    88,    86,    89,     0,     0,
  379.     43,    87,    89,     0,    41,     0,    42,     0,    46,     0,
  380.      0,    59,     0,    18,     0,    19,     0,    20,     0,    21,
  381.      0,    22,     0,    23,     0,    24,     0,    25,     0,    26,
  382.      0,    27,     0,    14,     0,    15,     0,    17,     0,    16,
  383.      0,    93,     0,    92,    93,     0,    59,     0,    60,     0,
  384.     61,     0,    65,    96,    65,     0,     0,     0,    64,    94,
  385.     98,    64,    95,    97,     0,     0,    59,     0,    60,     0,
  386.     61,     0,    64,     0,    62,     0,    66,   100,     0,     0,
  387.     66,    63,     0,    99,     0,    98,    99,     0,     0,    59,
  388.      0,    60,     0,    61,     0,    65,     0,    62,     0,    66,
  389.    100,     0,    59,     0,    60,     0,    61,     0,    64,     0,
  390.     66,     0,    65,     0,    63,     0
  391. };
  392.  
  393. #endif
  394.  
  395. #if YYDEBUG != 0
  396. static const short yyrline[] = { 0,
  397.    199,   200,   203,   205,   206,   207,   208,   209,   210,   213,
  398.    217,   220,   220,   223,   225,   226,   227,   228,   229,   230,
  399.    231,   232,   233,   234,   237,   238,   241,   243,   245,   247,
  400.    248,   251,   254,   258,   260,   261,   262,   263,   264,   265,
  401.    267,   271,   273,   275,   277,   278,   279,   280,   281,   282,
  402.    283,   284,   285,   286,   287,   288,   289,   290,   291,   292,
  403.    293,   294,   295,   296,   297,   298,   299,   300,   301,   302,
  404.    303,   306,   310,   313,   313,   315,   317,   319,   320,   323,
  405.    324,   327,   329,   330,   331,   332,   333,   334,   335,   336,
  406.    337,   340,   342,   343,   344,   347,   350,   354,   356,   357,
  407.    358,   361,   364,   367,   369,   370,   371,   372,   373,   374,
  408.    375,   379,   380,   383,   385,   389,   390,   391,   392,   393,
  409.    394,   395,   398,   400,   401,   402,   403,   404,   405
  410. };
  411.  
  412. static const char * const yytname[] = {   "$","error","$illegal.","T_INCLUDE",
  413. "T_DEFINE","T_UNDEF","T_PRAGMA","T_LINE","T_ERROR","T_IF","T_IFDEF","T_IFNDEF",
  414. "T_ELIF","T_ENDIF","T_AUTO","T_EXTERN","T_REGISTER","T_STATIC","T_CHAR","T_SHORT",
  415. "T_INT","T_LONG","T_SIGNED","T_UNSIGNED","T_FLOAT","T_DOUBLE","T_VOID","T_USERTYPE",
  416. "T_SWITCH","T_CASE","T_BREAK","T_DEFAULT","T_ELSE","T_FOR","T_DO","T_WHILE",
  417. "T_CONTINUE","T_CONST","T_VOLATILE","T_GOTO","T_RETURN","T_STRUCT","T_UNION",
  418. "T_ENUM","T_TYPEDEF","T_SIZEOF","T_CLASS","T_PUBLIC","T_PRIVATE","T_PROTECTED",
  419. "T_VIRTUAL","T_FRIEND","T_NEW","T_DELETE","T_OPERATOR","T_TRY","T_CATCH","T_THROW",
  420. "T_INLINE","T_ID","T_CHR","T_NUMBER","'#'","'\\n'","'\"'","'\\''","'\\\\'","input",
  421. "statement","@@1","cpp","cppline","@@2","cppkeyword","cpptextlist","define","@@3",
  422. "@@4","definelist","definetextlist","definetext","@@5","keywords","keywordsincomplete",
  423. "keywordscomplete","elaborated_type_specifier","@@6","@@7","class_key","elaborated_type_specifier_name",
  424. "simple_type_name","storage_class","textlist","text","@@8","@@9","char","stringend",
  425. "stringinner","stringtoken","stringescaped",""
  426. };
  427. #endif
  428.  
  429. static const short yyr1[] = {     0,
  430.     67,    67,    69,    68,    68,    68,    68,    68,    68,    70,
  431.     72,    71,    71,    73,    73,    73,    73,    73,    73,    73,
  432.     73,    73,    73,    73,    74,    74,    76,    77,    75,    78,
  433.     78,    79,    79,    80,    80,    80,    80,    80,    80,    81,
  434.     80,    82,    82,    83,    83,    83,    83,    83,    83,    83,
  435.     83,    83,    83,    83,    83,    83,    83,    83,    83,    83,
  436.     83,    83,    83,    83,    83,    83,    83,    83,    83,    83,
  437.     83,    84,    86,    85,    87,    85,    88,    88,    88,    89,
  438.     89,    90,    90,    90,    90,    90,    90,    90,    90,    90,
  439.     90,    91,    91,    91,    91,    92,    92,    93,    93,    93,
  440.     93,    94,    95,    93,    96,    96,    96,    96,    96,    96,
  441.     96,    97,    97,    98,    98,    99,    99,    99,    99,    99,
  442.     99,    99,   100,   100,   100,   100,   100,   100,   100
  443. };
  444.  
  445. static const short yyr2[] = {     0,
  446.      1,     2,     0,     3,     1,     1,     1,     1,     1,     2,
  447.      0,     3,     1,     1,     1,     1,     1,     1,     1,     1,
  448.      1,     1,     1,     1,     0,     1,     0,     0,     5,     0,
  449.      1,     1,     2,     1,     1,     1,     3,     3,     1,     0,
  450.      4,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  451.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  452.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  453.      1,     1,     0,     3,     0,     3,     1,     1,     1,     0,
  454.      1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
  455.      1,     1,     1,     1,     1,     1,     2,     1,     1,     1,
  456.      3,     0,     0,     6,     0,     1,     1,     1,     1,     1,
  457.      2,     0,     2,     1,     2,     0,     1,     1,     1,     1,
  458.      1,     2,     1,     1,     1,     1,     1,     1,     1
  459. };
  460.  
  461. static const short yydefact[] = {     0,
  462.     49,    92,    93,    95,    94,    82,    83,    84,    85,    86,
  463.     87,    88,    89,    90,    91,    46,    47,    48,    56,    50,
  464.     51,    52,    53,    54,    44,    45,    57,    55,    77,    78,
  465.     75,    58,    59,    79,    60,    61,    62,    63,    64,    65,
  466.     66,    67,    68,    69,    70,    71,    98,    99,   100,     3,
  467.      5,   102,   105,     0,     1,     8,    42,    43,    72,    73,
  468.      6,     7,     9,    96,    80,     0,   116,   106,   107,   108,
  469.    110,   109,     0,     0,     2,    80,    97,    81,    76,    14,
  470.     27,    15,    16,    17,    18,    19,    20,    21,    22,    23,
  471.     24,     4,     0,    11,    13,   117,   118,   119,   121,   120,
  472.      0,     0,   114,   123,   124,   125,   129,   126,   128,   127,
  473.    111,   101,    74,     0,    10,    25,   122,   103,   115,    28,
  474.     12,    26,   112,    30,     0,   104,    34,    35,    36,    39,
  475.    116,   105,     0,    29,    31,    32,   113,     0,     0,    40,
  476.     33,    37,    38,    30,    41,     0,     0
  477. };
  478.  
  479. static const short yydefgoto[] = {    54,
  480.     55,    66,    92,    93,   116,    94,   121,    95,   114,   124,
  481.    134,   135,   136,   144,    56,    57,    58,    59,    76,    65,
  482.     60,    79,    61,    62,    63,    64,    67,   123,    74,   126,
  483.    102,   103,   111
  484. };
  485.  
  486. static const short yypact[] = {    58,
  487. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  488. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  489. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  490. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  491. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  492. -32768,-32768,   -58,     0,-32768,-32768,-32768,-32768,-32768,-32768,
  493. -32768,-32768,   121,-32768,   -54,   122,   113,-32768,-32768,-32768,
  494. -32768,-32768,    77,   -55,-32768,   -54,-32768,-32768,-32768,-32768,
  495. -32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  496. -32768,-32768,   -52,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  497.     77,    85,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  498. -32768,-32768,-32768,   -47,-32768,   121,-32768,-32768,-32768,-32768,
  499. -32768,   121,   -53,    97,     5,-32768,-32768,-32768,-32768,-32768,
  500.    113,   -58,     6,-32768,    97,-32768,-32768,   105,    74,-32768,
  501. -32768,-32768,-32768,    97,-32768,    70,-32768
  502. };
  503.  
  504. static const short yypgoto[] = {-32768,
  505.     17,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  506.      4,-32768,    18,-32768,-32768,-32768,-32768,-32768,-32768,-32768,
  507. -32768,    76,-32768,-32768,    39,   -56,-32768,-32768,    36,-32768,
  508.     45,    22,    82
  509. };
  510.  
  511.  
  512. #define    YYLAST        186
  513.  
  514.  
  515. static const short yytable[] = {   146,
  516.     68,    69,    70,    71,    78,    72,    77,    73,     1,   112,
  517.    115,   120,   125,     2,     3,     4,     5,     6,     7,     8,
  518.      9,    10,    11,    12,    13,    14,    15,    16,    17,    18,
  519.     19,    20,    21,    22,    23,    24,    25,    26,    27,    28,
  520.     29,    30,    31,    32,    33,    34,    35,    36,    37,    38,
  521.     39,    40,    41,    42,    43,    44,    45,    46,    47,    48,
  522.     49,    50,    51,    52,    53,    77,     1,   137,   140,   147,
  523.     75,     2,     3,     4,     5,     6,     7,     8,     9,    10,
  524.     11,    12,    13,    14,    15,    16,    17,    18,    19,    20,
  525.     21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
  526.     31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
  527.     41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
  528.     51,    52,    53,   119,    80,    81,    82,    83,    84,    85,
  529.     86,    87,    88,    89,    90,   104,   105,   106,   143,   107,
  530.    108,   109,   110,    96,    97,    98,    99,   145,   118,   100,
  531.    101,   113,   141,    91,   122,   127,   128,   129,   130,   119,
  532.    131,   132,   133,    96,    97,    98,    99,   139,   142,   100,
  533.    101,    96,    97,    98,    99,   138,     0,   100,   101,    47,
  534.     48,    49,   117,     0,    52,    53
  535. };
  536.  
  537. static const short yycheck[] = {     0,
  538.     59,    60,    61,    62,    59,    64,    63,    66,     9,    65,
  539.     63,    59,    66,    14,    15,    16,    17,    18,    19,    20,
  540.     21,    22,    23,    24,    25,    26,    27,    28,    29,    30,
  541.     31,    32,    33,    34,    35,    36,    37,    38,    39,    40,
  542.     41,    42,    43,    44,    45,    46,    47,    48,    49,    50,
  543.     51,    52,    53,    54,    55,    56,    57,    58,    59,    60,
  544.     61,    62,    63,    64,    65,   122,     9,    63,    63,     0,
  545.     54,    14,    15,    16,    17,    18,    19,    20,    21,    22,
  546.     23,    24,    25,    26,    27,    28,    29,    30,    31,    32,
  547.     33,    34,    35,    36,    37,    38,    39,    40,    41,    42,
  548.     43,    44,    45,    46,    47,    48,    49,    50,    51,    52,
  549.     53,    54,    55,    56,    57,    58,    59,    60,    61,    62,
  550.     63,    64,    65,   102,     3,     4,     5,     6,     7,     8,
  551.      9,    10,    11,    12,    13,    59,    60,    61,    65,    63,
  552.     64,    65,    66,    59,    60,    61,    62,   144,    64,    65,
  553.     66,    76,   135,    32,   116,    59,    60,    61,    62,   138,
  554.     64,    65,    66,    59,    60,    61,    62,   132,    64,    65,
  555.     66,    59,    60,    61,    62,   131,    -1,    65,    66,    59,
  556.     60,    61,   101,    -1,    64,    65
  557. };
  558. #define YYPURE 1
  559.  
  560. /* -*-C-*-  Note some compilers choke on comments on `#line' lines.  */
  561. #line 3 "/gnu/lib/bison.simple"
  562.  
  563. /* Skeleton output parser for bison,
  564.     Copyright (C) 1984, 1989, 1990 Bob Corbett and Richard Stallman
  565.  
  566.     This program is free software; you can redistribute it and/or modify
  567.     it under the terms of the GNU General Public License as published by
  568.     the Free Software Foundation; either version 1, or (at your option)
  569.     any later version.
  570.  
  571.     This program is distributed in the hope that it will be useful,
  572.     but WITHOUT ANY WARRANTY; without even the implied warranty of
  573.     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  574.     GNU General Public License for more details.
  575.  
  576.     You should have received a copy of the GNU General Public License
  577.     along with this program; if not, write to the Free Software
  578.     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  579.  
  580. /* Added for Amiga SASC , and replaced fprintf(stderr,...) to printf(...)
  581.     Stefan Ruppert */
  582.  
  583. #ifdef __SASC
  584. #ifndef alloca
  585. #define alloca    malloc
  586. #endif
  587. #ifdef printf
  588. #undef printf
  589. #endif
  590. #define printf Printf
  591. static void __yy_bcopy (char *from,char *to,int count);
  592. #endif
  593.  
  594.  
  595. #ifndef alloca
  596. #ifdef __GNUC__
  597. #define alloca __builtin_alloca
  598. #else /* not GNU C.  */
  599. #if (!defined (__STDC__) && defined (sparc)) || defined (__sparc__) || defined (__sparc) || defined (__sgi)
  600. #include <alloca.h>
  601. #else /* not sparc */
  602. #if defined (MSDOS) && !defined (__TURBOC__)
  603. #include <malloc.h>
  604. #else /* not MSDOS, or __TURBOC__ */
  605. #if defined(_AIX)
  606. #include <malloc.h>
  607.  #pragma alloca
  608. #else /* not MSDOS, __TURBOC__, or _AIX */
  609. #ifdef __hpux
  610. #ifdef __cplusplus
  611. extern "C" {
  612. void *alloca (unsigned int);
  613. };
  614. #else /* not __cplusplus */
  615. void *alloca ();
  616. #endif /* not __cplusplus */
  617. #endif /* __hpux */
  618. #endif /* not _AIX */
  619. #endif /* not MSDOS, or __TURBOC__ */
  620. #endif /* not sparc.  */
  621. #endif /* not GNU C.  */
  622. #endif /* alloca not defined.  */
  623.  
  624. /* This is the parser code that is written into each bison parser
  625.   when the %semantic_parser declaration is not specified in the grammar.
  626.   It was written by Richard Stallman by simplifying the hairy parser
  627.   used when %semantic_parser is specified.  */
  628.  
  629. /* Note: there must be only one dollar sign in this file.
  630.     It is replaced by the list of actions, each action
  631.     as one case of the switch.  */
  632.  
  633. #define yyerrok         (yyerrstatus = 0)
  634. #define yyclearin       (yychar = YYEMPTY)
  635. #define YYEMPTY         -2
  636. #define YYEOF           0
  637. #define YYACCEPT        return(0)
  638. #define YYABORT         return(1)
  639. #define YYERROR         goto yyerrlab1
  640. /* Like YYERROR except do call yyerror.
  641.     This remains here temporarily to ease the
  642.     transition to the new meaning of YYERROR, for GCC.
  643.     Once GCC version 2 has supplanted version 1, this can go.  */
  644. #define YYFAIL          goto yyerrlab
  645. #define YYRECOVERING()  (!!yyerrstatus)
  646. #define YYBACKUP(token, value) \
  647. do                                                              \
  648.   if (yychar == YYEMPTY && yylen == 1)                          \
  649.      { yychar = (token), yylval = (value);                       \
  650.         yychar1 = YYTRANSLATE (yychar);                           \
  651.         YYPOPSTACK;                                               \
  652.         goto yybackup;                                            \
  653.      }                                                           \
  654.   else                                                          \
  655.      { yyerror ("syntax error: cannot back up"); YYERROR; }      \
  656. while (0)
  657.  
  658. #define YYTERROR        1
  659. #define YYERRCODE       256
  660.  
  661. #ifndef YYPURE
  662. #define YYLEX           yylex()
  663. #endif
  664.  
  665. #ifdef YYPURE
  666. #ifdef YYLSP_NEEDED
  667. #define YYLEX           yylex(&yylval, &yylloc)
  668. #else
  669. #define YYLEX           yylex(&yylval)
  670. #endif
  671. #endif
  672.  
  673. /* If nonreentrant, generate the variables here */
  674.  
  675. #ifndef YYPURE
  676.  
  677. int     yychar;                 /*  the lookahead symbol                */
  678. YYSTYPE yylval;                 /*  the semantic value of the           */
  679.                                           /*  lookahead symbol                    */
  680.  
  681. #ifdef YYLSP_NEEDED
  682. YYLTYPE yylloc;                 /*  location data for the lookahead     */
  683.                                           /*  symbol                              */
  684. #endif
  685.  
  686. int yynerrs;                    /*  number of parse errors so far       */
  687. #endif  /* not YYPURE */
  688.  
  689. #if YYDEBUG != 0
  690. int yydebug;                    /*  nonzero means print parse trace     */
  691. /* Since this is uninitialized, it does not stop multiple parsers
  692.     from coexisting.  */
  693. #endif
  694.  
  695. /*  YYINITDEPTH indicates the initial size of the parser's stacks       */
  696.  
  697. #ifndef YYINITDEPTH
  698. #define YYINITDEPTH 200
  699. #endif
  700.  
  701. /*  YYMAXDEPTH is the maximum size the stacks can grow to
  702.      (effective only if the built-in stack extension method is used).  */
  703.  
  704. #if YYMAXDEPTH == 0
  705. #undef YYMAXDEPTH
  706. #endif
  707.  
  708. #ifndef YYMAXDEPTH
  709. #define YYMAXDEPTH 10000
  710. #endif
  711.  
  712. /* Prevent warning if -Wstrict-prototypes.  */
  713. #ifdef __GNUC__
  714. int yyparse(struct ClassBase *cb,struct CParse *cparse);
  715. #endif
  716.  
  717. #if __GNUC__ > 1                /* GNU C and GNU C++ define this.  */
  718. #define __yy_bcopy(FROM,TO,COUNT)       __builtin_memcpy(TO,FROM,COUNT)
  719. #else                           /* not GNU C or C++ */
  720. #ifndef __cplusplus
  721.  
  722. /* This is the most reliable way to avoid incompatibilities
  723.     in available built-in functions on various systems.  */
  724. static void
  725. __yy_bcopy (from, to, count)
  726.       char *from;
  727.       char *to;
  728.       int count;
  729. {
  730.   register char *f = from;
  731.   register char *t = to;
  732.   register int i = count;
  733.  
  734.   while (i-- > 0)
  735.      *t++ = *f++;
  736. }
  737.  
  738. #else /* __cplusplus */
  739.  
  740. /* This is the most reliable way to avoid incompatibilities
  741.     in available built-in functions on various systems.  */
  742. static void
  743. __yy_bcopy (char *from, char *to, int count)
  744. {
  745.   register char *f = from;
  746.   register char *t = to;
  747.   register int i = count;
  748.  
  749.   while (i-- > 0)
  750.      *t++ = *f++;
  751. }
  752.  
  753. #endif
  754. #endif
  755.  
  756. #line 184 "/gnu/lib/bison.simple"
  757. int
  758. yyparse(struct ClassBase *cb,struct CParse *cparse)
  759. {
  760.   register int yystate;
  761.   register int yyn;
  762.   register short *yyssp;
  763.   register YYSTYPE *yyvsp;
  764.   int yyerrstatus;      /*  number of tokens to shift before error messages enabled */
  765.   int yychar1;              /*  lookahead token as an internal (translated) token number */
  766.  
  767.   short yyssa[YYINITDEPTH];     /*  the state stack                     */
  768.   YYSTYPE yyvsa[YYINITDEPTH];   /*  the semantic value stack            */
  769.  
  770.   short *yyss = yyssa;          /*  refer to the stacks thru separate pointers */
  771.   YYSTYPE *yyvs = yyvsa;        /*  to allow yyoverflow to reallocate them elsewhere */
  772.  
  773. #ifdef YYLSP_NEEDED
  774.   YYLTYPE yylsa[YYINITDEPTH];   /*  the location stack                  */
  775.   YYLTYPE *yyls = yylsa;
  776.   YYLTYPE *yylsp;
  777.  
  778. #define YYPOPSTACK   (yyvsp--, yyssp--, yylsp--)
  779. #else
  780. #define YYPOPSTACK   (yyvsp--, yyssp--)
  781. #endif
  782.  
  783.   int yystacksize = YYINITDEPTH;
  784.  
  785. #ifdef YYPURE
  786.   int yychar;
  787.   YYSTYPE yylval;
  788.   int yynerrs;
  789. #ifdef YYLSP_NEEDED
  790.   YYLTYPE yylloc;
  791. #endif
  792. #endif
  793.  
  794.   YYSTYPE yyval;                /*  the variable used to return         */
  795.                                           /*  semantic values from the action     */
  796.                                           /*  routines                            */
  797.  
  798.   int yylen;
  799.  
  800. #if YYDEBUG != 0
  801.   if (yydebug)
  802.      printf( "Starting parse\n");
  803. #endif
  804.  
  805.   yystate = 0;
  806.   yyerrstatus = 0;
  807.   yynerrs = 0;
  808.   yychar = YYEMPTY;             /* Cause a token to be read.  */
  809.  
  810.   /* Initialize stack pointers.
  811.       Waste one element of value and location stack
  812.       so that they stay on the same level as the state stack.
  813.       The wasted elements are never initialized.  */
  814.  
  815.   yyssp = yyss - 1;
  816.   yyvsp = yyvs;
  817. #ifdef YYLSP_NEEDED
  818.   yylsp = yyls;
  819. #endif
  820.  
  821. /* Push a new state, which is found in  yystate  .  */
  822. /* In all cases, when you get here, the value and location stacks
  823.     have just been pushed. so pushing a state here evens the stacks.  */
  824. yynewstate:
  825.  
  826.   *++yyssp = yystate;
  827.  
  828.   if (yyssp >= yyss + yystacksize - 1)
  829.      {
  830.         /* Give user a chance to reallocate the stack */
  831.         /* Use copies of these so that the &'s don't force the real ones into memory. */
  832.         YYSTYPE *yyvs1 = yyvs;
  833.         short *yyss1 = yyss;
  834. #ifdef YYLSP_NEEDED
  835.         YYLTYPE *yyls1 = yyls;
  836. #endif
  837.  
  838.         /* Get the current used size of the three stacks, in elements.  */
  839.         int size = yyssp - yyss + 1;
  840.  
  841. #ifdef yyoverflow
  842.         /* Each stack pointer address is followed by the size of
  843.             the data in use in that stack, in bytes.  */
  844. #ifdef YYLSP_NEEDED
  845.         /* This used to be a conditional around just the two extra args,
  846.             but that might be undefined if yyoverflow is a macro.  */
  847.         yyoverflow("parser stack overflow",
  848.                       &yyss1, size * sizeof (*yyssp),
  849.                       &yyvs1, size * sizeof (*yyvsp),
  850.                       &yyls1, size * sizeof (*yylsp),
  851.                       &yystacksize);
  852. #else
  853.         yyoverflow("parser stack overflow",
  854.                       &yyss1, size * sizeof (*yyssp),
  855.                       &yyvs1, size * sizeof (*yyvsp),
  856.                       &yystacksize);
  857. #endif
  858.  
  859.         yyss = yyss1; yyvs = yyvs1;
  860. #ifdef YYLSP_NEEDED
  861.         yyls = yyls1;
  862. #endif
  863. #else /* no yyoverflow */
  864.         /* Extend the stack our own way.  */
  865.         if (yystacksize >= YYMAXDEPTH)
  866.           {
  867.              yyerror("parser stack overflow");
  868.              return 2;
  869.           }
  870.         yystacksize *= 2;
  871.         if (yystacksize > YYMAXDEPTH)
  872.           yystacksize = YYMAXDEPTH;
  873.         yyss = (short *) alloca (yystacksize * sizeof (*yyssp));
  874.         __yy_bcopy ((char *)yyss1, (char *)yyss, size * sizeof (*yyssp));
  875.         yyvs = (YYSTYPE *) alloca (yystacksize * sizeof (*yyvsp));
  876.         __yy_bcopy ((char *)yyvs1, (char *)yyvs, size * sizeof (*yyvsp));
  877. #ifdef YYLSP_NEEDED
  878.         yyls = (YYLTYPE *) alloca (yystacksize * sizeof (*yylsp));
  879.         __yy_bcopy ((char *)yyls1, (char *)yyls, size * sizeof (*yylsp));
  880. #endif
  881. #endif /* no yyoverflow */
  882.  
  883.         yyssp = yyss + size - 1;
  884.         yyvsp = yyvs + size - 1;
  885. #ifdef YYLSP_NEEDED
  886.         yylsp = yyls + size - 1;
  887. #endif
  888.  
  889. #if YYDEBUG != 0
  890.         if (yydebug)
  891.           printf( "Stack size increased to %ld\n", yystacksize);
  892. #endif
  893.  
  894.         if (yyssp >= yyss + yystacksize - 1)
  895.           YYABORT;
  896.      }
  897.  
  898. #if YYDEBUG != 0
  899.   if (yydebug)
  900.       printf( "Entering state %ld\n", yystate);
  901. #endif
  902.  
  903.   goto yybackup;
  904.  yybackup:
  905.  
  906. /* Do appropriate processing given the current state.  */
  907. /* Read a lookahead token if we need one and don't already have one.  */
  908. /* yyresume: */
  909.  
  910.   /* First try to decide what to do without reference to lookahead token.  */
  911.  
  912.   yyn = yypact[yystate];
  913.   if (yyn == YYFLAG)
  914.      goto yydefault;
  915.  
  916.   /* Not known => get a lookahead token if don't already have one.  */
  917.  
  918.   /* yychar is either YYEMPTY or YYEOF
  919.       or a valid token in external form.  */
  920.  
  921.   if (yychar == YYEMPTY)
  922.      {
  923. #if YYDEBUG != 0
  924.         if (yydebug)
  925.           printf( "Reading a token: ");
  926. #endif
  927.         yychar = yylex(&yylval,cb,cparse);
  928.      }
  929.  
  930.   /* Convert token to internal form (in yychar1) for indexing tables with */
  931.  
  932.   if (yychar <= 0)              /* This means end of input. */
  933.      {
  934.         yychar1 = 0;
  935.         yychar = YYEOF;           /* Don't call YYLEX any more */
  936.  
  937. #if YYDEBUG != 0
  938.         if (yydebug)
  939.           printf( "Now at end of input.\n");
  940. #endif
  941.      }
  942.   else
  943.      {
  944.         yychar1 = YYTRANSLATE(yychar);
  945.  
  946. #if YYDEBUG != 0
  947.         if (yydebug)
  948.           {
  949.              printf ("Next token is %ld (%s", yychar, yytname[yychar1]);
  950.              /* Give the individual parser a way to print the precise meaning
  951.                  of a token, for further debugging info.  */
  952. #ifdef YYPRINT
  953.              YYPRINT (yychar, yylval);
  954. #endif
  955.              printf (")\n");
  956.           }
  957. #endif
  958.      }
  959.  
  960.   yyn += yychar1;
  961.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
  962.      goto yydefault;
  963.  
  964.   yyn = yytable[yyn];
  965.  
  966.   /* yyn is what to do for this token type in this state.
  967.       Negative => reduce, -yyn is rule number.
  968.       Positive => shift, yyn is new state.
  969.          New state is final state => don't bother to shift,
  970.          just return success.
  971.       0, or most negative number => error.  */
  972.  
  973.   if (yyn < 0)
  974.      {
  975.         if (yyn == YYFLAG)
  976.           goto yyerrlab;
  977.         yyn = -yyn;
  978.         goto yyreduce;
  979.      }
  980.   else if (yyn == 0)
  981.      goto yyerrlab;
  982.  
  983.   if (yyn == YYFINAL)
  984.      YYACCEPT;
  985.  
  986.   /* Shift the lookahead token.  */
  987.  
  988. #if YYDEBUG != 0
  989.   if (yydebug)
  990.      printf( "Shifting token %ld (%s), ", yychar, yytname[yychar1]);
  991. #endif
  992.  
  993.   /* Discard the token being shifted unless it is eof.  */
  994.   if (yychar != YYEOF)
  995.      yychar = YYEMPTY;
  996.  
  997.   *++yyvsp = yylval;
  998. #ifdef YYLSP_NEEDED
  999.   *++yylsp = yylloc;
  1000. #endif
  1001.  
  1002.   /* count tokens shifted since error; after three, turn off error status.  */
  1003.   if (yyerrstatus) yyerrstatus--;
  1004.  
  1005.   yystate = yyn;
  1006.   goto yynewstate;
  1007.  
  1008. /* Do the default action for the current state.  */
  1009. yydefault:
  1010.  
  1011.   yyn = yydefact[yystate];
  1012.   if (yyn == 0)
  1013.      goto yyerrlab;
  1014.  
  1015. /* Do a reduction.  yyn is the number of a rule to reduce with.  */
  1016. yyreduce:
  1017.   yylen = yyr2[yyn];
  1018.   if (yylen > 0)
  1019.      yyval = yyvsp[1-yylen]; /* implement default value of the action */
  1020.  
  1021. #if YYDEBUG != 0
  1022.   if (yydebug)
  1023.      {
  1024.         int i;
  1025.  
  1026.         printf ("Reducing via rule %ld (line %ld), ",
  1027.                     yyn, yyrline[yyn]);
  1028.  
  1029.         /* Print the symbols being reduced, and their result.  */
  1030.         for (i = yyprhs[yyn]; yyrhs[i] > 0; i++)
  1031.           printf ("%s ", yytname[yyrhs[i]]);
  1032.         printf (" -> %s\n", yytname[yyr1[yyn]]);
  1033.      }
  1034. #endif
  1035.  
  1036.  
  1037.   switch (yyn) {
  1038.  
  1039. case 3:
  1040. #line 204 "cdt.y"
  1041. { cparse->Mode = C_CPP; ;
  1042.     break;}
  1043. case 4:
  1044. #line 205 "cdt.y"
  1045. { cparse->Mode = C_STANDARD; ;
  1046.     break;}
  1047. case 5:
  1048. #line 206 "cdt.y"
  1049. { add_cexpr(cb,cparse,C_STANDARD,LNF_LF); ;
  1050.     break;}
  1051. case 6:
  1052. #line 207 "cdt.y"
  1053. { add_cexpr(cb,cparse,C_TYPES,0);   ;
  1054.     break;}
  1055. case 7:
  1056. #line 208 "cdt.y"
  1057. { add_cexpr(cb,cparse,C_STORAGE,0); ;
  1058.     break;}
  1059. case 10:
  1060. #line 214 "cdt.y"
  1061. { add_cexpr(cb,cparse,C_STANDARD,LNF_LF); ;
  1062.     break;}
  1063. case 11:
  1064. #line 218 "cdt.y"
  1065. { add_cexpr(cb,cparse,C_CPP,0); cparse->Mode = C_CPPTEXTLIST; ;
  1066.     break;}
  1067. case 27:
  1068. #line 242 "cdt.y"
  1069. { add_cexpr(cb,cparse,C_CPP,0); cparse->Mode = C_CPPTEXTLIST; cparse->TxtPtr = cparse->ActPtr; ;
  1070.     break;}
  1071. case 28:
  1072. #line 243 "cdt.y"
  1073. { cparse->TxtPtr = cparse->ActPtr;  ;
  1074.     break;}
  1075. case 32:
  1076. #line 252 "cdt.y"
  1077. { if(cparse->XOffsetAdd) add_cexpr(cb,cparse,C_STANDARD,0);
  1078.                                                 cparse->TxtPtr = cparse->ActPtr;   ;
  1079.     break;}
  1080. case 33:
  1081. #line 254 "cdt.y"
  1082. { if(cparse->XOffsetAdd) add_cexpr(cb,cparse,C_STANDARD,0);
  1083.                                                 cparse->TxtPtr = cparse->ActPtr;   ;
  1084.     break;}
  1085. case 36:
  1086. #line 261 "cdt.y"
  1087. { add_cexpr(cb,cparse,C_NUMBER,0);   ;
  1088.     break;}
  1089. case 37:
  1090. #line 262 "cdt.y"
  1091. { add_cexpr(cb,cparse,C_STRING,0);   ;
  1092.     break;}
  1093. case 38:
  1094. #line 263 "cdt.y"
  1095. { add_cexpr(cb,cparse,C_STRING,0);   ;
  1096.     break;}
  1097. case 39:
  1098. #line 264 "cdt.y"
  1099. { cparse->TxtPtr = cparse->ActPtr;   ;
  1100.     break;}
  1101. case 40:
  1102. #line 265 "cdt.y"
  1103. { add_cexpr(cb,cparse,C_STANDARD,LNF_LF); ;
  1104.     break;}
  1105. case 42:
  1106. #line 272 "cdt.y"
  1107. { add_cexpr(cb,cparse,C_KEYWORD,0); ;
  1108.     break;}
  1109. case 73:
  1110. #line 311 "cdt.y"
  1111. { add_cexpr(cb,cparse,C_KEYWORD,0); ;
  1112.     break;}
  1113. case 75:
  1114. #line 313 "cdt.y"
  1115. { add_cexpr(cb,cparse,C_KEYWORD,0); ;
  1116.     break;}
  1117. case 81:
  1118. #line 324 "cdt.y"
  1119. { add_cexpr(cb,cparse,C_TYPENAME,0); ;
  1120.     break;}
  1121. case 96:
  1122. #line 348 "cdt.y"
  1123. { if(cparse->XOffsetAdd) add_cexpr(cb,cparse,C_STANDARD,0);
  1124.                                               cparse->TxtPtr = cparse->ActPtr; ;
  1125.     break;}
  1126. case 97:
  1127. #line 350 "cdt.y"
  1128. { if(cparse->XOffsetAdd)  add_cexpr(cb,cparse,C_STANDARD,0);
  1129.                                               cparse->TxtPtr = cparse->ActPtr; ;
  1130.     break;}
  1131. case 98:
  1132. #line 355 "cdt.y"
  1133. {  ;
  1134.     break;}
  1135. case 100:
  1136. #line 357 "cdt.y"
  1137. { add_cexpr(cb,cparse,C_NUMBER,0); ;
  1138.     break;}
  1139. case 101:
  1140. #line 360 "cdt.y"
  1141. { add_cexpr(cb,cparse,C_STRING,0); ;
  1142.     break;}
  1143. case 102:
  1144. #line 361 "cdt.y"
  1145. { cparse->ActPtr--;add_cexpr(cb,cparse,C_STANDARD,0);
  1146.                                               cparse->ActPtr++;cparse->Mode = C_STRING;         ;
  1147.     break;}
  1148. case 103:
  1149. #line 364 "cdt.y"
  1150. { add_cexpr(cb,cparse,C_STRING,0);
  1151.                                               cparse->Mode = C_STANDARD; ;
  1152.     break;}
  1153. case 113:
  1154. #line 380 "cdt.y"
  1155. { add_cexpr(cb,cparse,C_STANDARD,LNF_LF); ;
  1156.     break;}
  1157. case 129:
  1158. #line 405 "cdt.y"
  1159. { add_cexpr(cb,cparse,C_STRING,LNF_LF); ;
  1160.     break;}
  1161. }
  1162.    /* the action file gets copied in in place of this dollarsign */
  1163. #line 465 "/gnu/lib/bison.simple"
  1164.  
  1165.   yyvsp -= yylen;
  1166.   yyssp -= yylen;
  1167. #ifdef YYLSP_NEEDED
  1168.   yylsp -= yylen;
  1169. #endif
  1170.  
  1171. #if YYDEBUG != 0
  1172.   if (yydebug)
  1173.      {
  1174.         short *ssp1 = yyss - 1;
  1175.         printf ("state stack now");
  1176.         while (ssp1 != yyssp)
  1177.           printf (" %ld", *++ssp1);
  1178.         printf ("\n");
  1179.      }
  1180. #endif
  1181.  
  1182.   *++yyvsp = yyval;
  1183.  
  1184. #ifdef YYLSP_NEEDED
  1185.   yylsp++;
  1186.   if (yylen == 0)
  1187.      {
  1188.         yylsp->first_line = yylloc.first_line;
  1189.         yylsp->first_column = yylloc.first_column;
  1190.         yylsp->last_line = (yylsp-1)->last_line;
  1191.         yylsp->last_column = (yylsp-1)->last_column;
  1192.         yylsp->text = 0;
  1193.      }
  1194.   else
  1195.      {
  1196.         yylsp->last_line = (yylsp+yylen-1)->last_line;
  1197.         yylsp->last_column = (yylsp+yylen-1)->last_column;
  1198.      }
  1199. #endif
  1200.  
  1201.   /* Now "shift" the result of the reduction.
  1202.       Determine what state that goes to,
  1203.       based on the state we popped back to
  1204.       and the rule number reduced by.  */
  1205.  
  1206.   yyn = yyr1[yyn];
  1207.  
  1208.   yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
  1209.   if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
  1210.      yystate = yytable[yystate];
  1211.   else
  1212.      yystate = yydefgoto[yyn - YYNTBASE];
  1213.  
  1214.   goto yynewstate;
  1215.  
  1216. yyerrlab:   /* here on detecting error */
  1217.  
  1218.   if (! yyerrstatus)
  1219.      /* If not already recovering from an error, report this error.  */
  1220.      {
  1221.         ++yynerrs;
  1222.  
  1223. #ifdef YYERROR_VERBOSE
  1224.         yyn = yypact[yystate];
  1225.  
  1226.         if (yyn > YYFLAG && yyn < YYLAST)
  1227.           {
  1228.              int size = 0;
  1229.              char *msg;
  1230.              int x, count;
  1231.  
  1232.              count = 0;
  1233.              /* Start X at -yyn if nec to avoid negative indexes in yycheck.  */
  1234.              for (x = (yyn < 0 ? -yyn : 0);
  1235.                     x < (sizeof(yytname) / sizeof(char *)); x++)
  1236.                 if (yycheck[x + yyn] == x)
  1237.                   size += strlen(yytname[x]) + 15, count++;
  1238.              msg = (char *) malloc(size + 15);
  1239.              if (msg != 0)
  1240.                 {
  1241.                   strcpy(msg, "parse error");
  1242.  
  1243.                   if (count < 5)
  1244.                      {
  1245.                         count = 0;
  1246.                         for (x = (yyn < 0 ? -yyn : 0);
  1247.                               x < (sizeof(yytname) / sizeof(char *)); x++)
  1248.                           if (yycheck[x + yyn] == x)
  1249.                              {
  1250.                                 strcat(msg, count == 0 ? ", expecting `" : " or `");
  1251.                                 strcat(msg, yytname[x]);
  1252.                                 strcat(msg, "'");
  1253.                                 count++;
  1254.                              }
  1255.                      }
  1256.                   yyerror(msg);
  1257.                   free(msg);
  1258.                 }
  1259.              else
  1260.                 yyerror ("parse error; also virtual memory exceeded");
  1261.           }
  1262.         else
  1263. #endif /* YYERROR_VERBOSE */
  1264.           cdtparse_parseerror(cb,cparse);
  1265.      }
  1266.  
  1267.   goto yyerrlab1;
  1268. yyerrlab1:   /* here on error raised explicitly by an action */
  1269.  
  1270.   if (yyerrstatus == 3)
  1271.      {
  1272.         /* if just tried and failed to reuse lookahead token after an error, discard it.  */
  1273.  
  1274.         /* return failure if at end of input */
  1275.         if (yychar == YYEOF)
  1276.           YYABORT;
  1277.  
  1278. #if YYDEBUG != 0
  1279.         if (yydebug)
  1280.           printf( "Discarding token %ld (%s).\n", yychar, yytname[yychar1]);
  1281. #endif
  1282.  
  1283.         yychar = YYEMPTY;
  1284.      }
  1285.  
  1286.   /* Else will try to reuse lookahead token
  1287.       after shifting the error token.  */
  1288.  
  1289.   yyerrstatus = 3;              /* Each real token shifted decrements this */
  1290.  
  1291.   goto yyerrhandle;
  1292.  
  1293. yyerrdefault:  /* current state does not do anything special for the error token. */
  1294.  
  1295. #if 0
  1296.   /* This is wrong; only states that explicitly want error tokens
  1297.       should shift them.  */
  1298.   yyn = yydefact[yystate];  /* If its default is to accept any token, ok.  Otherwise pop it.*/
  1299.   if (yyn) goto yydefault;
  1300. #endif
  1301.  
  1302. yyerrpop:   /* pop the current state because it cannot handle the error token */
  1303.  
  1304.   if (yyssp == yyss) YYABORT;
  1305.   yyvsp--;
  1306.   yystate = *--yyssp;
  1307. #ifdef YYLSP_NEEDED
  1308.   yylsp--;
  1309. #endif
  1310.  
  1311. #if YYDEBUG != 0
  1312.   if (yydebug)
  1313.      {
  1314.         short *ssp1 = yyss - 1;
  1315.         printf ("Error: state stack now");
  1316.         while (ssp1 != yyssp)
  1317.           printf (" %ld", *++ssp1);
  1318.         printf ("\n");
  1319.      }
  1320. #endif
  1321.  
  1322. yyerrhandle:
  1323.  
  1324.   yyn = yypact[yystate];
  1325.   if (yyn == YYFLAG)
  1326.      goto yyerrdefault;
  1327.  
  1328.   yyn += YYTERROR;
  1329.   if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
  1330.      goto yyerrdefault;
  1331.  
  1332.   yyn = yytable[yyn];
  1333.   if (yyn < 0)
  1334.      {
  1335.         if (yyn == YYFLAG)
  1336.           goto yyerrpop;
  1337.         yyn = -yyn;
  1338.         goto yyreduce;
  1339.      }
  1340.   else if (yyn == 0)
  1341.      goto yyerrpop;
  1342.  
  1343.   if (yyn == YYFINAL)
  1344.      YYACCEPT;
  1345.  
  1346. #if YYDEBUG != 0
  1347.   if (yydebug)
  1348.      printf( "Shifting error token, ");
  1349. #endif
  1350.  
  1351.   *++yyvsp = yylval;
  1352. #ifdef YYLSP_NEEDED
  1353.   *++yylsp = yylloc;
  1354. #endif
  1355.  
  1356.   yystate = yyn;
  1357.   goto yynewstate;
  1358. }
  1359. #line 408 "cdt.y"
  1360.  
  1361.  
  1362. /*FS*/ /*"Keyword definition"*/
  1363. struct Keyword
  1364. {
  1365.     STRPTR k_Word;
  1366.     int k_ID;
  1367.     int k_Len;
  1368. };
  1369.  
  1370. struct Keyword keywords[] =
  1371. {
  1372.     {"auto"     ,T_AUTO      ,4},
  1373.     {"break"    ,T_BREAK     ,5},
  1374.     {"case"     ,T_CASE      ,4},
  1375.     {"catch"    ,T_CATCH     ,5},
  1376.     {"char"     ,T_CHAR      ,4},
  1377.     {"class"    ,T_CLASS     ,5},
  1378.     {"const"    ,T_CONST     ,5},
  1379.     {"continue" ,T_CONTINUE  ,8},
  1380.     {"default"  ,T_DEFAULT   ,7},
  1381.     {"delete"   ,T_DELETE    ,6},
  1382.     {"do"       ,T_DO        ,2},
  1383.     {"double"   ,T_DOUBLE    ,6},
  1384.     {"else"     ,T_ELSE      ,4},
  1385.     {"enum"     ,T_ENUM      ,4},
  1386.     {"extern"   ,T_EXTERN    ,6},
  1387.     {"float"    ,T_FLOAT     ,5},
  1388.     {"for"      ,T_FOR       ,3},
  1389.     {"friend"   ,T_FRIEND    ,6},
  1390.     {"goto"     ,T_GOTO      ,4},
  1391.     {"if"       ,T_IF        ,2},
  1392.     {"inline"   ,T_INLINE    ,6},
  1393.     {"int"      ,T_INT       ,3},
  1394.     {"long"     ,T_LONG      ,4},
  1395.     {"new"      ,T_NEW       ,3},
  1396.     {"operator" ,T_OPERATOR  ,8},
  1397.     {"private"  ,T_PRIVATE   ,7},
  1398.     {"protected",T_PROTECTED ,9},
  1399.     {"public"   ,T_PUBLIC    ,6},
  1400.     {"register" ,T_REGISTER  ,8},
  1401.     {"return"   ,T_RETURN    ,6},
  1402.     {"short"    ,T_SHORT     ,5},
  1403.     {"signed"   ,T_SIGNED    ,6},
  1404.     {"sizeof"   ,T_SIZEOF    ,6},
  1405.     {"static"   ,T_STATIC    ,6},
  1406.     {"struct"   ,T_STRUCT    ,6},
  1407.     {"switch"   ,T_SWITCH    ,6},
  1408.     {"throw"    ,T_THROW     ,5},
  1409.     {"try"      ,T_TRY       ,3},
  1410.     {"typedef"  ,T_TYPEDEF   ,7},
  1411.     {"union"    ,T_UNION     ,5},
  1412.     {"unsigned" ,T_UNSIGNED  ,8},
  1413.     {"virtual"  ,T_VIRTUAL   ,7},
  1414.     {"void"     ,T_VOID      ,4},
  1415.     {"volatile" ,T_VOLATILE  ,8},
  1416.     {"while"    ,T_WHILE     ,5},
  1417.     {NULL       ,0}
  1418. };
  1419.  
  1420. struct Keyword cppkeywords[] =
  1421. {
  1422.     {"define"   ,T_DEFINE    ,6},
  1423.     {"elif"     ,T_ELIF      ,4},
  1424.     {"else"     ,T_ELSE      ,4},
  1425.     {"endif"    ,T_ENDIF     ,5},
  1426.     {"error"    ,T_ERROR     ,5},
  1427.     {"if"       ,T_IF        ,2},
  1428.     {"ifdef"    ,T_IFDEF     ,5},
  1429.     {"ifndef"   ,T_IFNDEF    ,6},
  1430.     {"include"  ,T_INCLUDE   ,7},
  1431.     {"line"     ,T_LINE      ,4},
  1432.     {"pragma"   ,T_PRAGMA    ,6},
  1433.     {"undef"    ,T_UNDEF     ,5},
  1434.     {NULL       ,0}
  1435. };
  1436. /*FE*/
  1437.  
  1438. /*FS*/ int cdtparse_lex(int *lvalp,struct ClassBase *cb,struct CParse *cparse)
  1439. {
  1440.     struct CData *cd = cparse->Data;
  1441.     STRPTR ptr = cparse->ActPtr;
  1442.     STRPTR end = cparse->EndPtr;
  1443.     STRPTR name;
  1444.     ULONG tablen = cd->cd_TabLength;
  1445.     LONG addx;
  1446.     struct Keyword *kw = NULL;
  1447.     int retval = 0;
  1448.     int len;
  1449.  
  1450.     if(ptr < end)
  1451.     {
  1452.         do
  1453.         {
  1454.  
  1455.             while(ptr < end && (*ptr == ' ' || *ptr == '\t'))
  1456.             {
  1457.                 if(*ptr == '\t')
  1458.                 {
  1459.                     addx = (tablen - (cparse->Chars % tablen));
  1460.  
  1461.                     cparse->XOffsetAdd += addx;
  1462.                     cparse->Chars      += addx;
  1463.                 } else
  1464.                     cparse->Chars++;
  1465.  
  1466.                 ptr++;
  1467.             }
  1468.  
  1469.             /* handle comments */
  1470.             if(*ptr == '/' && ptr < end - 1 && (ptr[1] == '*' || ptr[1] == '/') && cparse->Mode != C_STRING)
  1471.             {
  1472.                 ptr += 2;
  1473.                 if(ptr[-1] == '*')
  1474.                 {
  1475.                     int nested = 1;
  1476.  
  1477.                     while(ptr < end && nested)
  1478.                     {
  1479.                         switch(*ptr)
  1480.                         {
  1481.                         case '*':
  1482.                             if(ptr[1] == '/')
  1483.                             {
  1484.                                 nested--;
  1485.                                 ptr++;
  1486.                             }
  1487.                             break;
  1488.                         case '/':
  1489.                             if(ptr[1] == '*' && cparse->Data->cd_Flags.Nested)
  1490.                             {
  1491.                                 nested++;
  1492.                                 ptr++;
  1493.                             }
  1494.                             break;
  1495.                         case '\n':
  1496.                             ptr++;
  1497.                             cparse->ActPtr = ptr;
  1498.                             add_cexpr(cb,cparse,C_COMMENT,LNF_LF);
  1499.                             cparse->Chars = 0;
  1500.                             continue;
  1501.                         case '\t':
  1502.                             cparse->ActPtr = ptr;
  1503.                             if(cparse->Chars)
  1504.                                 add_cexpr(cb,cparse,C_COMMENT,0);
  1505.  
  1506.                             while(*ptr == '\t' || *ptr == ' ')
  1507.                             {
  1508.                                 if(*ptr == '\t')
  1509.                                 {
  1510.                                     addx = (tablen - (cparse->Chars % tablen));
  1511.  
  1512.                                     cparse->XOffsetAdd += addx;
  1513.                                     cparse->Chars      += addx;
  1514.                                 } else
  1515.                                     cparse->Chars++;
  1516.                                 ptr++;
  1517.                             }
  1518.                             ptr--;
  1519.                             break;
  1520.                         }
  1521.                         cparse->Chars++;
  1522.                         ptr++;
  1523.                     }
  1524.                     cparse->ActPtr = ptr;
  1525.                     add_cexpr(cb,cparse,C_COMMENT,0);
  1526.                 } else
  1527.                 {
  1528.                     while(ptr < end && *ptr != '\n')
  1529.                     {
  1530.                         if(*ptr == '\t')
  1531.                         {
  1532.                             cparse->ActPtr = ptr;
  1533.  
  1534.                             add_cexpr(cb,cparse,C_COMMENT,0);
  1535.  
  1536.                             while(*ptr == '\t')
  1537.                             {
  1538.                                 addx = (tablen - (cparse->Chars % tablen));
  1539.  
  1540.                                 cparse->XOffsetAdd += addx;
  1541.                                 cparse->Chars      += addx;
  1542.                                 ptr++;
  1543.                             }
  1544.                         } else
  1545.                             cparse->Chars++;
  1546.                         ptr++;
  1547.                     }
  1548.                     ptr++;
  1549.                     cparse->ActPtr = ptr;
  1550.  
  1551.                     add_cexpr(cb,cparse,C_COMMENT,LNF_LF);
  1552.                     cparse->Chars = 0;
  1553.                 }
  1554.             } else
  1555.                 break;
  1556.  
  1557.         } while(*ptr == ' ' || *ptr == '\t' || *ptr == '/');
  1558.  
  1559.         if(ptr < end)
  1560.         {
  1561.             if(isalpha(*ptr) || *ptr == '_')
  1562.             {
  1563.                 name = ptr;
  1564.  
  1565.                 while(ptr < end && (isalpha(*ptr) || isdigit(*ptr) || *ptr == '_'))
  1566.                     ptr++;
  1567.  
  1568.                 len  = (ptr - name);
  1569.  
  1570.                 ptr--;
  1571.  
  1572.                 retval = T_ID;
  1573.  
  1574.                 /* only search for keyword if it is normal text or a cppline !!! */
  1575.                 if(cparse->Mode == C_CPP)
  1576.                     kw = cppkeywords;
  1577.                 else if(cparse->Mode == C_STANDARD)
  1578.                     kw = keywords;
  1579.  
  1580.                 if(len > 1 && kw)
  1581.                 {
  1582.                     int cmp;
  1583.  
  1584.                     while(kw->k_Word)
  1585.                     {
  1586.                         if(!(cmp = strncmp(kw->k_Word,name,len)))
  1587.                         {
  1588.                             DB(("len = %ld , strlen(kw) = %ld\n",len,kw->k_Len));
  1589.                             if(len == kw->k_Len)
  1590.                             {
  1591.                                 retval = kw->k_ID;
  1592.                                 break;
  1593.                             }
  1594.                         } else if(cmp > 0)
  1595.                             break;
  1596.                         kw++;
  1597.                     }
  1598.  
  1599.                     /* try user defined type keywords */
  1600.                     if(cmp)
  1601.                     {
  1602.                         struct Node *node;
  1603.                         for(node = cd->cd_UserTypes.lh_Head ; node->ln_Succ ; node = node->ln_Succ)
  1604.                         {
  1605.                             if(len == node->ln_Type && !strncmp(node->ln_Name,name,len))
  1606.                             {
  1607.                                 retval = T_USERTYPE;
  1608.                                 break;
  1609.                             }
  1610.                         }
  1611.                     }
  1612.                 }
  1613.                 cparse->Chars += len;
  1614.                 cparse->ActPtr = ptr + 1;
  1615.             } else if(isdigit(*ptr))
  1616.             {
  1617.                 name = ptr;
  1618.                 ptr++;
  1619.  
  1620.                 if(*ptr == 'x')
  1621.                 {
  1622.                     ptr++;
  1623.                     while(ptr < end && isxdigit(*ptr))
  1624.                         ptr++;
  1625.                 } else
  1626.                 {
  1627.                     while(ptr < end && isdigit(*ptr))
  1628.                         ptr++;
  1629.                 }
  1630.  
  1631.                 ptr--;
  1632.                 cparse->Chars += (ptr - name);
  1633.                 cparse->ActPtr = ptr + 1;
  1634.  
  1635.                 retval = T_NUMBER;
  1636.             } else
  1637.             {
  1638.                 retval = T_CHR;
  1639.  
  1640.                 cparse->Chars++;
  1641.                 switch(*ptr)
  1642.                 {
  1643.                 case '\n':
  1644.                     cparse->Chars = 0;
  1645.                 case '"':
  1646.                 case '#':
  1647.                 case '\\':
  1648.                 case '\'':
  1649.                     retval = *ptr;
  1650.                     break;
  1651.                 }
  1652.                 cparse->ActPtr = ptr + 1;
  1653.             }
  1654.         }
  1655.     }
  1656.  
  1657.     DB(("token : %ld\n",retval));
  1658.     cparse->Token = retval;
  1659.  
  1660.     return(retval);
  1661. }
  1662. /*FE*/
  1663.  
  1664. /*FS*/ void *cdtparse_alloc(struct ClassBase *cb,struct CParse *cparse,int size)
  1665. {
  1666.     struct cdtMem *mem;
  1667.  
  1668.     if((mem = AllocPooled(cparse->Data->cd_Pool,size + sizeof(struct cdtMem))))
  1669.     {
  1670.         mem->Next = cparse->Memory;
  1671.         mem->Size = size + sizeof(struct cdtMem);
  1672.  
  1673.         mem++;
  1674.     }
  1675.     return(mem);
  1676. }
  1677. /*FE*/
  1678. /*FS*/ void cdtparse_free(struct ClassBase *cb,struct CParse *cparse)
  1679. {
  1680.     struct cdtMem *mem = cparse->Memory;
  1681.     struct cdtMem *next;
  1682.  
  1683.     while(mem)
  1684.     {
  1685.         next = mem->Next;
  1686.         mem--;
  1687.         FreePooled(cparse->Data->cd_Pool,mem,mem->Size);
  1688.         mem = next;
  1689.     }
  1690. }
  1691. /*FE*/
  1692.  
  1693. /*FS*/ int cdtparse_error(char *str)
  1694. {
  1695.     DB(("error : %s\n",str));
  1696.     return(0);
  1697. }
  1698. /*FE*/
  1699. /*FS*/ void cdtparse_parseerror(struct ClassBase *cb,struct CParse *cparse)
  1700. {
  1701.     char *buf;
  1702.  
  1703.     if((buf = AllocPooled(cparse->Data->cd_Pool,50)))
  1704.     {
  1705.         STRPTR seg = cparse->SegPtr;
  1706.         STRPTR act = cparse->ActPtr;
  1707.  
  1708.         sprintf(buf,"Parse Error : last Token %4ld for line :",cparse->Token);
  1709.         cparse->SegPtr = buf;
  1710.         cparse->ActPtr = buf + strlen(buf);
  1711.         add_line(cb,cparse,C_STANDARD,LNF_LF);
  1712.  
  1713.         while(seg > cparse->BegPtr && *seg != '\n')
  1714.             seg--;
  1715.  
  1716.         if(*seg == '\n')
  1717.             seg++;
  1718.  
  1719.         while(act < cparse->EndPtr && *act != '\n')
  1720.             act++;
  1721.         cparse->SegPtr = seg;
  1722.         cparse->ActPtr = act;
  1723.         add_line(cb,cparse,C_STANDARD,LNF_LF);
  1724.     }
  1725. }
  1726. /*FE*/
  1727.  
  1728. @
  1729.  
  1730.  
  1731. 39.12
  1732. log
  1733. @*** empty log    message    ***
  1734. @
  1735. text
  1736. @d79 1
  1737. a79 1
  1738. ** $VER: cdt.y 39.11 (04.06.95)
  1739. d90 1
  1740. d356 13
  1741. a368 13
  1742.    198,   199,   202,   204,   205,   206,   207,   208,   209,   212,
  1743.    216,   219,   219,   222,   224,   225,   226,   227,   228,   229,
  1744.    230,   231,   232,   233,   236,   237,   240,   242,   244,   246,
  1745.    247,   250,   253,   257,   259,   260,   261,   262,   263,   264,
  1746.    266,   270,   272,   274,   276,   277,   278,   279,   280,   281,
  1747.    282,   283,   284,   285,   286,   287,   288,   289,   290,   291,
  1748.    292,   293,   294,   295,   296,   297,   298,   299,   300,   301,
  1749.    302,   305,   309,   312,   312,   314,   316,   318,   319,   322,
  1750.    323,   326,   328,   329,   330,   331,   332,   333,   334,   335,
  1751.    336,   339,   341,   342,   343,   346,   349,   353,   355,   356,
  1752.    357,   360,   363,   366,   368,   369,   370,   371,   372,   373,
  1753.    374,   378,   379,   382,   384,   388,   389,   390,   391,   392,
  1754.    393,   394,   397,   399,   400,   401,   402,   403,   404
  1755. d999 1
  1756. a999 1
  1757. #line 203 "cdt.y"
  1758. d1003 1
  1759. a1003 1
  1760. #line 204 "cdt.y"
  1761. d1007 1
  1762. a1007 1
  1763. #line 205 "cdt.y"
  1764. d1011 1
  1765. a1011 1
  1766. #line 206 "cdt.y"
  1767. d1015 1
  1768. a1015 1
  1769. #line 207 "cdt.y"
  1770. d1019 1
  1771. a1019 1
  1772. #line 213 "cdt.y"
  1773. d1023 1
  1774. a1023 1
  1775. #line 217 "cdt.y"
  1776. d1027 2
  1777. a1028 2
  1778. #line 241 "cdt.y"
  1779. { add_cexpr(cb,cparse,C_CPP,0); cparse->Mode = C_CPPTEXTLIST; ;
  1780. d1031 1
  1781. a1031 1
  1782. #line 242 "cdt.y"
  1783. d1035 1
  1784. a1035 1
  1785. #line 251 "cdt.y"
  1786. d1040 1
  1787. a1040 1
  1788. #line 253 "cdt.y"
  1789. d1045 1
  1790. a1045 1
  1791. #line 260 "cdt.y"
  1792. d1049 1
  1793. a1049 1
  1794. #line 261 "cdt.y"
  1795. d1053 1
  1796. a1053 1
  1797. #line 262 "cdt.y"
  1798. d1057 1
  1799. a1057 1
  1800. #line 263 "cdt.y"
  1801. d1061 1
  1802. a1061 1
  1803. #line 264 "cdt.y"
  1804. d1065 1
  1805. a1065 1
  1806. #line 271 "cdt.y"
  1807. d1069 1
  1808. a1069 1
  1809. #line 310 "cdt.y"
  1810. d1073 1
  1811. a1073 1
  1812. #line 312 "cdt.y"
  1813. d1077 1
  1814. a1077 1
  1815. #line 323 "cdt.y"
  1816. d1081 1
  1817. a1081 1
  1818. #line 347 "cdt.y"
  1819. d1086 1
  1820. a1086 1
  1821. #line 349 "cdt.y"
  1822. d1091 1
  1823. a1091 1
  1824. #line 354 "cdt.y"
  1825. d1095 1
  1826. a1095 1
  1827. #line 356 "cdt.y"
  1828. d1099 1
  1829. a1099 1
  1830. #line 359 "cdt.y"
  1831. d1103 1
  1832. a1103 1
  1833. #line 360 "cdt.y"
  1834. d1108 1
  1835. a1108 1
  1836. #line 363 "cdt.y"
  1837. d1113 1
  1838. a1113 1
  1839. #line 379 "cdt.y"
  1840. d1117 1
  1841. a1117 1
  1842. #line 404 "cdt.y"
  1843. d1318 1
  1844. a1318 1
  1845. #line 407 "cdt.y"
  1846. d1413 1
  1847. d1493 1
  1848. a1493 2
  1849.                             if(cparse->Chars)
  1850.                                 add_cexpr(cb,cparse,C_COMMENT,0);
  1851. @
  1852.  
  1853.  
  1854. 39.11
  1855. log
  1856. @*** empty log    message    ***
  1857. @
  1858. text
  1859. @d79 1
  1860. a79 1
  1861. ** $VER: cdt.y 39.10 (10.05.95)
  1862. d90 1
  1863. d355 13
  1864. a367 13
  1865.    197,   198,   201,   203,   204,   205,   206,   207,   208,   211,
  1866.    215,   218,   218,   221,   223,   224,   225,   226,   227,   228,
  1867.    229,   230,   231,   232,   235,   236,   239,   241,   243,   245,
  1868.    246,   249,   252,   256,   258,   259,   260,   261,   262,   263,
  1869.    265,   269,   271,   273,   275,   276,   277,   278,   279,   280,
  1870.    281,   282,   283,   284,   285,   286,   287,   288,   289,   290,
  1871.    291,   292,   293,   294,   295,   296,   297,   298,   299,   300,
  1872.    301,   304,   308,   311,   311,   313,   315,   317,   318,   321,
  1873.    322,   325,   327,   328,   329,   330,   331,   332,   333,   334,
  1874.    335,   338,   340,   341,   342,   345,   348,   352,   354,   355,
  1875.    356,   359,   362,   365,   367,   368,   369,   370,   371,   372,
  1876.    373,   377,   378,   381,   383,   387,   388,   389,   390,   391,
  1877.    392,   393,   396,   398,   399,   400,   401,   402,   403
  1878. d998 1
  1879. a998 1
  1880. #line 202 "cdt.y"
  1881. d1002 1
  1882. a1002 1
  1883. #line 203 "cdt.y"
  1884. d1006 1
  1885. a1006 1
  1886. #line 204 "cdt.y"
  1887. d1010 1
  1888. a1010 1
  1889. #line 205 "cdt.y"
  1890. d1014 1
  1891. a1014 1
  1892. #line 206 "cdt.y"
  1893. d1018 1
  1894. a1018 1
  1895. #line 212 "cdt.y"
  1896. d1022 1
  1897. a1022 1
  1898. #line 216 "cdt.y"
  1899. d1026 1
  1900. a1026 1
  1901. #line 240 "cdt.y"
  1902. d1030 1
  1903. a1030 1
  1904. #line 241 "cdt.y"
  1905. d1034 1
  1906. a1034 1
  1907. #line 250 "cdt.y"
  1908. d1039 1
  1909. a1039 1
  1910. #line 252 "cdt.y"
  1911. d1044 1
  1912. a1044 1
  1913. #line 259 "cdt.y"
  1914. d1048 1
  1915. a1048 1
  1916. #line 260 "cdt.y"
  1917. d1052 1
  1918. a1052 1
  1919. #line 261 "cdt.y"
  1920. d1056 1
  1921. a1056 1
  1922. #line 262 "cdt.y"
  1923. d1060 1
  1924. a1060 1
  1925. #line 263 "cdt.y"
  1926. d1064 1
  1927. a1064 1
  1928. #line 270 "cdt.y"
  1929. d1068 1
  1930. a1068 1
  1931. #line 309 "cdt.y"
  1932. d1072 1
  1933. a1072 1
  1934. #line 311 "cdt.y"
  1935. d1076 1
  1936. a1076 1
  1937. #line 322 "cdt.y"
  1938. d1080 1
  1939. a1080 1
  1940. #line 346 "cdt.y"
  1941. d1085 1
  1942. a1085 1
  1943. #line 348 "cdt.y"
  1944. d1090 1
  1945. a1090 1
  1946. #line 353 "cdt.y"
  1947. d1094 1
  1948. a1094 1
  1949. #line 355 "cdt.y"
  1950. d1098 1
  1951. a1098 1
  1952. #line 358 "cdt.y"
  1953. d1102 1
  1954. a1102 1
  1955. #line 359 "cdt.y"
  1956. d1107 1
  1957. a1107 1
  1958. #line 362 "cdt.y"
  1959. d1112 1
  1960. a1112 1
  1961. #line 378 "cdt.y"
  1962. d1116 1
  1963. a1116 1
  1964. #line 403 "cdt.y"
  1965. d1317 1
  1966. a1317 1
  1967. #line 406 "cdt.y"
  1968. @
  1969.  
  1970.  
  1971. 39.10
  1972. log
  1973. @*** empty log    message    ***
  1974. @
  1975. text
  1976. @d79 1
  1977. a79 1
  1978. ** $VER: cdt.y 39.9 (28.04.95)
  1979. d90 1
  1980. d104 1
  1981. a104 1
  1982. void add_line(struct ClassBase *cb,struct CParse *cparse,ULONG index,UWORD flags)
  1983. d114 1
  1984. a115 1
  1985.             ULONG x = cparse->XOffsetAdd;
  1986. d117 1
  1987. a117 1
  1988.             while(*ptr == ' ' || *ptr == '\t')
  1989. d119 28
  1990. a146 3
  1991.                 if(*ptr == ' ')
  1992.                     x += cparse->TabWidth;
  1993.                 ptr++;
  1994. d150 1
  1995. d162 1
  1996. a162 1
  1997.             line->ln_XOffset  = cparse->XOffset + x;
  1998. d164 1
  1999. a164 1
  2000.             line->ln_Width    = TextLength(cparse->RPort,line->ln_Text,line->ln_TextLen) + x;
  2001. d202 1
  2002. d204 1
  2003. a204 1
  2004. void add_cexpr(struct ClassBase *cb,struct CParse *cparse,ULONG index,BOOL lf)
  2005. d227 1
  2006. d354 13
  2007. a366 13
  2008.    168,   169,   172,   174,   175,   176,   177,   178,   179,   182,
  2009.    186,   189,   189,   192,   194,   195,   196,   197,   198,   199,
  2010.    200,   201,   202,   203,   206,   207,   210,   212,   214,   216,
  2011.    217,   220,   223,   227,   229,   230,   231,   232,   233,   234,
  2012.    236,   240,   242,   244,   246,   247,   248,   249,   250,   251,
  2013.    252,   253,   254,   255,   256,   257,   258,   259,   260,   261,
  2014.    262,   263,   264,   265,   266,   267,   268,   269,   270,   271,
  2015.    272,   275,   279,   282,   282,   284,   286,   288,   289,   292,
  2016.    293,   296,   298,   299,   300,   301,   302,   303,   304,   305,
  2017.    306,   309,   311,   312,   313,   316,   319,   323,   325,   326,
  2018.    327,   330,   333,   336,   338,   339,   340,   341,   342,   343,
  2019.    344,   348,   349,   352,   354,   358,   359,   360,   361,   362,
  2020.    363,   364,   367,   369,   370,   371,   372,   373,   374
  2021. d997 1
  2022. a997 1
  2023. #line 173 "cdt.y"
  2024. d1001 1
  2025. a1001 1
  2026. #line 174 "cdt.y"
  2027. d1005 1
  2028. a1005 1
  2029. #line 175 "cdt.y"
  2030. d1009 1
  2031. a1009 1
  2032. #line 176 "cdt.y"
  2033. d1013 1
  2034. a1013 1
  2035. #line 177 "cdt.y"
  2036. d1017 1
  2037. a1017 1
  2038. #line 183 "cdt.y"
  2039. d1021 1
  2040. a1021 1
  2041. #line 187 "cdt.y"
  2042. d1025 1
  2043. a1025 1
  2044. #line 211 "cdt.y"
  2045. d1029 1
  2046. a1029 1
  2047. #line 212 "cdt.y"
  2048. d1033 1
  2049. a1033 1
  2050. #line 221 "cdt.y"
  2051. d1038 1
  2052. a1038 1
  2053. #line 223 "cdt.y"
  2054. d1043 1
  2055. a1043 1
  2056. #line 230 "cdt.y"
  2057. d1047 1
  2058. a1047 1
  2059. #line 231 "cdt.y"
  2060. d1051 1
  2061. a1051 1
  2062. #line 232 "cdt.y"
  2063. d1055 1
  2064. a1055 1
  2065. #line 233 "cdt.y"
  2066. d1059 1
  2067. a1059 1
  2068. #line 234 "cdt.y"
  2069. d1063 1
  2070. a1063 1
  2071. #line 241 "cdt.y"
  2072. d1067 1
  2073. a1067 1
  2074. #line 280 "cdt.y"
  2075. d1071 1
  2076. a1071 1
  2077. #line 282 "cdt.y"
  2078. d1075 1
  2079. a1075 1
  2080. #line 293 "cdt.y"
  2081. d1079 1
  2082. a1079 1
  2083. #line 317 "cdt.y"
  2084. d1084 1
  2085. a1084 1
  2086. #line 319 "cdt.y"
  2087. d1089 1
  2088. a1089 1
  2089. #line 324 "cdt.y"
  2090. d1093 1
  2091. a1093 1
  2092. #line 326 "cdt.y"
  2093. d1097 1
  2094. a1097 1
  2095. #line 329 "cdt.y"
  2096. d1101 1
  2097. a1101 1
  2098. #line 330 "cdt.y"
  2099. d1106 1
  2100. a1106 1
  2101. #line 333 "cdt.y"
  2102. d1111 1
  2103. a1111 1
  2104. #line 349 "cdt.y"
  2105. d1115 1
  2106. a1115 1
  2107. #line 374 "cdt.y"
  2108. d1316 1
  2109. a1316 1
  2110. #line 377 "cdt.y"
  2111. d1319 1
  2112. d1393 1
  2113. d1395 1
  2114. a1395 1
  2115. int cdtparse_lex(int *lvalp,struct ClassBase *cb,struct CParse *cparse)
  2116. d1402 1
  2117. a1402 1
  2118.     LONG addx,chrs;
  2119. a1410 1
  2120.             chrs = cparse->Chars;
  2121. d1417 1
  2122. a1417 4
  2123.                     if(chrs)
  2124.                         cparse->XOffsetAdd += addx * cparse->TabWidth;
  2125.                     else
  2126.                         cparse->XOffset    += addx * cparse->TabWidth;
  2127. d1459 1
  2128. a1459 2
  2129.                             chrs = cparse->Chars;
  2130.                             if(chrs)
  2131. d1461 1
  2132. d1468 1
  2133. a1468 4
  2134.                                     if(chrs > 0)
  2135.                                         cparse->XOffsetAdd += addx * cparse->TabWidth;
  2136.                                     else
  2137.                                         cparse->XOffset    += addx * cparse->TabWidth;
  2138. d1489 4
  2139. a1492 2
  2140.                             add_cexpr(cb,cparse,C_COMMENT,0);
  2141.                             chrs = cparse->Chars;
  2142. d1497 1
  2143. a1497 4
  2144.                                 if(chrs)
  2145.                                     cparse->XOffsetAdd += addx * cparse->TabWidth;
  2146.                                 else
  2147.                                     cparse->XOffset    += addx * cparse->TabWidth;
  2148. d1562 1
  2149. a1562 1
  2150.                             if(!strncmp(node->ln_Name,name,len) && len == node->ln_Type)
  2151. d1619 1
  2152. d1621 1
  2153. a1621 1
  2154. void *cdtparse_alloc(struct ClassBase *cb,struct CParse *cparse,int size)
  2155. d1634 2
  2156. a1635 2
  2157.  
  2158. void cdtparse_free(struct ClassBase *cb,struct CParse *cparse)
  2159. d1648 1
  2160. d1650 1
  2161. a1650 1
  2162. int cdtparse_error(char *str)
  2163. d1655 2
  2164. a1656 2
  2165.  
  2166. void cdtparse_parseerror(struct ClassBase *cb,struct CParse *cparse)
  2167. d1683 1
  2168. @
  2169.